This repository has been archived by the owner on Jul 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 465
abi-gen/Py: fix incorrect method return types and other small issues #2345
Merged
+679
−847
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously, the routines `order_to_jsdict()` and `jsdict_to_order()` were moved from contract_wrappers.exchange.types to contract_wrappers.order_conversions. However, the module-level docstring describing those routines was accidentally left behind in exchange.types.
test_cli:lint is meant to be a rudimentary test of the code generated by abi-gen. However, previously, this script was incorporated into `yarn lint`, and in CircleCI `static-tests` runs independently of `build`. Consequently, the runs of test_cli:lint were checking the OLD code, which was previously generated and checked in to git, NOT the code generated with the version of abi-gen represented by the git repo. Now, test_cli:lint happens during `yarn test` rather than `yarn lint`, because `yarn test` IS dependent on `yarn build`.
Previously the send_transaction() interface included docstring documentation for the return types of the contract method, but that doesn't make any sense because send_transaction() returns a transaction hash rather than any actual return values.
Previously, generated wrappers for contract methods were including type hints that suggested that a call() (as opposed to a send_transaction()) might return either the underlying return type or a transaction hash. This doesn't make sense because a call() will never return a TX hash. Now, the type hint just has the return type of the underlying method.
Move all existing Python-related Handlebars helpers to the newly created python_handlebars_helpers module.
No functionality is changed. Sole purpose of this commit is to facilitate an upcoming commit.
No functionality is changed. Sole purpose of this commit is to facilitate an upcoming commit.
Use the new `internalType` field on the `DataItem`s in the contract artifact to give generated tuple classes a better name than just hashing their component field names.
|
fabioberger
approved these changes
Nov 15, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once CI passes
feuGeneA
force-pushed
the
fix/python/return-types
branch
from
November 15, 2019 21:02
bf20721
to
70de33b
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #2298
Testing instructions
It's all in CI
Types of changes
Checklist:
call()
interface to a method is currently stated to have return type likeUnion[X, Union[HexBytes, bytes]]
, when really it should just beX
. b42d8e0zero_ex.contract_wrappers.exchange.types
explaining how it contains conversion routines. They used to be in that module, but those routines got moved to contract_wrappers.order_conversions. Move that doc to that module. 8c3008czero_ex.contract_wrappers.bases.ContractMethod
,buildTransaction()
, which simply does a validation and delegation to the underlying web3.py implementation (just like ourestimateGas()
method currently does). 99a4794abi-gen
Move all Python handlebars into the new module created to hold them. 2de9637internalType
field in ABI to know when tuples are Solidity structs vs when they're literal tuples, and use that information to give meaningful names to the generated tuple classes. 17b70cfvalidator
parameter on their constructor when the underlying methods don't have any inputs. 58270e1zero_ex.contract_wrappers.[GENERATED_CONTRACT].underlying_method
to_underlying_method
.